package com.ruoyi.business.controller;

import com.ruoyi.business.domain.AlarmInfo;
import com.ruoyi.business.vo.WaterVo;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * 四级水温Controller
 *
 * @author qiancheng
 * @date 2025-09-07
 */
@RestController
@RequestMapping("/business/water") // 接口路径：业务模块/警报管理
public class WaterController extends BaseController {


    /**
     * 按条件查询警报列表，支持时间范围和等级筛选
     * @return 符合条件的警报列表
     */
    @Anonymous
    @GetMapping("/list")
    public AjaxResult getAlarmList() {
        WaterVo waterVo = new WaterVo();
        Random random = new Random();
        List<Double> yAxis = new ArrayList<>();
        List<Integer> XAxis = new ArrayList<>();

        for (int i = 1; i <=50; i++) {

            // 生成25~26之间的随机水温，保留2位小数
            double temp = 25 + 1*random.nextDouble();
            yAxis.add(Math.round(temp * 100.0) / 100.0);


            XAxis.add(i);
        }

        waterVo.setXAxis(XAxis);
        waterVo.setYAxis(yAxis);


      return success(waterVo);
    }
}